import React from 'react';
import { format } from '@/utils/datetime';
import { renderNumber } from '@/utils/common';
import CommonPage from '@/components/page/CommonPage';
const daoName = 'ShCompTydq';
const importName = 'ShCompTydq';
const columns: API.Column[] = [
  {
    title: '日期',
    width: 120,
    sorter: true,
    key: 'DTID',
    dataIndex: 'DTID',
    render: (data) => format(data, 'yyyy-MM-dd'),
    dispaly: true,
    filter: true,
    export: false,
  },
  {
    title: '业务品种',
    width: 180,
    sorter: true,
    dataIndex: 'YWPZ',
    key: 'YWPZ',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '账号',
    width: 200,
    sorter: true,
    dataIndex: 'ACNO',
    key: 'ACNO',
    dispaly: true,
    filter: true,
    export: true,
    ellipsis: true,
  },
  {
    title: '子账号',
    width: 100,
    sorter: true,
    dataIndex: 'BANO',
    key: 'BANO',
    dispaly: true,
    filter: true,
    export: true,
    ellipsis: true,
  },
  {
    title: '交易对手',
    width: 250,
    sorter: true,
    dataIndex: 'JYDS',
    key: 'JYDS',
    dispaly: true,
    filter: true,
    export: true,
    ellipsis: true,
  },
  {
    title: '合同金额',
    width: 150,
    sorter: true,
    dataIndex: 'HTJE',
    key: 'HTJE',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '合同起息日',
    width: 130,
    sorter: true,
    key: 'VLDT',
    dataIndex: 'VLDT',
    render: (data) => format(data, 'yyyy-MM-dd'),
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '合同到期日',
    width: 130,
    sorter: true,
    key: 'MODT',
    dataIndex: 'MODT',
    render: (data) => format(data, 'yyyy-MM-dd'),
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '合同期限',
    width: 120,
    sorter: true,
    dataIndex: 'HTQX',
    key: 'HTQX',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '利率(%)',
    width: 110,
    sorter: true,
    dataIndex: 'INRT',
    key: 'INRT',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '付息方式',
    width: 120,
    sorter: true,
    dataIndex: 'FXFS',
    key: 'FXFS',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '账户余额',
    width: 150,
    sorter: true,
    dataIndex: 'ACBL',
    render: (data) => renderNumber('.2f', data),
    key: 'ACBL',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
  },
  {
    title: '计息起息日',
    width: 220,
    sorter: true,
    dataIndex: 'JXVLAT',
    key: 'JXVLAT',
    dispaly: false,
    filter: true,
    export: true,
  },
  {
    title: '计息到期日',
    width: 220,
    sorter: true,
    dataIndex: 'JXMODT',
    key: 'JXMODT',
    dispaly: false,
    filter: true,
    export: true,
  },
  {
    title: '执行利率(%)',
    width: 130,
    sorter: true,
    dataIndex: 'ZXLL',
    key: 'ZXLL',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: 'FTP参考',
    width: 120,
    sorter: true,
    dataIndex: 'FTPCK',
    key: 'FTPCK',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: 'FTP值',
    width: 110,
    sorter: true,
    dataIndex: 'FTPZ',
    key: 'FTPZ',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: 'FTP利差',
    width: 130,
    sorter: true,
    dataIndex: 'FTPLC',
    key: 'FTPLC',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '本月期限',
    width: 130,
    sorter: true,
    dataIndex: 'QX1',
    key: 'QX1',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '本月利润',
    width: 130,
    sorter: true,
    dataIndex: 'LR1',
    key: 'LR1',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '绩费计算',
    width: 130,
    sorter: true,
    dataIndex: 'JFJS',
    key: 'JFJS',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '工号1',
    width: 100,
    sorter: true,
    dataIndex: 'GH1',
    key: 'GH1',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '客户经理1',
    width: 130,
    sorter: true,
    dataIndex: 'KHJL1',
    key: 'KHJL1',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比1',
    width: 80,
    sorter: true,
    dataIndex: 'ZB1',
    key: 'ZB1',
    dispaly: true,
    filter: false,
    export: true,
  },
  {
    title: '工号2',
    width: 100,
    sorter: true,
    dataIndex: 'GH2',
    key: 'GH2',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '客户经理2',
    width: 130,
    sorter: true,
    dataIndex: 'KHJL2',
    key: 'KHJL2',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比2',
    width: 80,
    sorter: true,
    dataIndex: 'ZB2',
    key: 'ZB2',
    dispaly: true,
    filter: false,
    export: true,
  },
  {
    title: '工号3',
    width: 100,
    sorter: true,
    dataIndex: 'GH3',
    key: 'GH3',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '客户经理3',
    width: 130,
    sorter: true,
    dataIndex: 'KHJL3',
    key: 'KHJL3',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比3',
    width: 80,
    sorter: true,
    dataIndex: 'ZB3',
    key: 'ZB3',
    dispaly: true,
    filter: false,
    export: true,
  },
];
const controls: API.Control[] = [
  {
    name: 'DTID',
    dataType: 'date',
    type: 'date',
    label: '日期',
    grid: 12 / 24,
    rules: [{ required: true, message: '不能为空' }],
  },
  {
    name: 'YWPZ',
    type: 'text',
    label: '业务品种',
    grid: 12 / 24,
    rules: [{ required: true, message: '不能为空' }],
  },
  {
    name: 'ACNO',
    type: 'text',
    label: '账号',
    grid: 12 / 24,
  },
  { name: 'BANO', type: 'text', label: '子账号', grid: 12 / 24 },
  { name: 'JYDS', type: 'text', label: '交易对手', grid: 12 / 24 },
  { name: 'HTJE', type: 'number', dataType: 'number', label: '合同金额', grid: 12 / 24 },
  { name: 'VLDT', dataType: 'date', type: 'date', label: '合同起息日', grid: 12 / 24 },
  { name: 'MODT', dataType: 'date', type: 'date', label: '合同到期日', grid: 12 / 24 },
  { name: 'HTQX', type: 'text', label: '合同期限', grid: 12 / 24 },
  { name: 'INRT', type: 'number', dataType: 'number', label: '利率', grid: 12 / 24 },
  { name: 'FXFS', type: 'text', label: '付息方式', grid: 12 / 24 },
  { name: 'ACBL', type: 'number', dataType: 'number', label: '账户余额', grid: 12 / 24 },
  { name: 'JXVLAT', type: 'text', label: '计息起息日', grid: 12 / 24 },
  { name: 'JXMODT', type: 'text', label: '计息到期日', grid: 12 / 24 },
  { name: 'ZXLL', type: 'number', dataType: 'number', label: '执行利率', grid: 12 / 24 },
  { name: 'FTPCK', type: 'text', label: 'FTP参考', grid: 12 / 24 },
  { name: 'FTPZ', type: 'number', dataType: 'number', label: 'FTP值', grid: 12 / 24 },
  { name: 'FTPLC', type: 'number', dataType: 'number', label: 'FTP利差', grid: 12 / 24 },
  { name: 'QX1', type: 'number', dataType: 'number', label: '本月期限', grid: 12 / 24 },
  {
    name: 'LR1',
    type: 'number',
    dataType: 'number',
    label: '本月利润',
    grid: 12 / 24,
    rules: [{ required: true, message: '不能为空' }],
  },
  { name: 'JFJS', type: 'text', label: '绩费计算', grid: 12 / 24 },
  {
    name: 'GH1',
    type: 'text',
    label: '工号1',
    grid: 12 / 24,
    rules: [{ required: true, message: '不能为空' }],
  },
  {
    name: 'KHJL1',
    type: 'text',
    label: '客户经理1',
    grid: 12 / 24,
    rules: [{ required: true, message: '不能为空' }],
  },
  {
    name: 'ZB1',
    type: 'number',
    dataType: 'number',
    label: '占比1',
    grid: 12 / 24,
    rules: [{ required: true, message: '不能为空' }],
  },
  { name: 'GH2', type: 'text', label: '工号2', grid: 12 / 24 },
  { name: 'KHJL2', type: 'text', label: '客户经理2', grid: 12 / 24 },
  { name: 'ZB2', type: 'number', dataType: 'number', label: '占比2', grid: 12 / 24 },
  { name: 'GH3', type: 'text', label: '工号3', grid: 12 / 24 },
  { name: 'KHJL3', type: 'text', label: '客户经理3', grid: 12 / 24 },
  { name: 'ZB3', type: 'number', dataType: 'number', label: '占比3', grid: 12 / 24 },
];

const controlsImport: API.Control[] = [
  {
    name: 'DTID',
    dataType: 'date',
    type: 'month',
    label: '日期',
    grid: 12 / 24,
    rules: [{ required: true, message: '不能为空' }],
  },
  {
    name: 'YWPZ',
    type: 'text',
    label: '业务品种',
    grid: 12 / 24,
    rules: [{ required: true, message: '不能为空' }],
  },
  {
    name: 'ACNO',
    type: 'text',
    label: '账号',
    grid: 12 / 24,
  },
  { name: 'BANO', type: 'text', label: '子账号', grid: 12 / 24 },
  { name: 'JYDS', type: 'text', label: '交易对手', grid: 12 / 24 },
  { name: 'HTJE', type: 'number', dataType: 'number', label: '合同金额', grid: 12 / 24 },
  { name: 'VLDT', dataType: 'date', type: 'date', label: '合同起息日', grid: 12 / 24 },
  { name: 'MODT', dataType: 'date', type: 'date', label: '合同到期日', grid: 12 / 24 },
  { name: 'HTQX', type: 'text', label: '合同期限', grid: 12 / 24 },
  { name: 'INRT', type: 'number', dataType: 'number', label: '利率', grid: 12 / 24 },
  { name: 'FXFS', type: 'text', label: '付息方式', grid: 12 / 24 },
  { name: 'ACBL', type: 'number', dataType: 'number', label: '账户余额', grid: 12 / 24 },
  { name: 'JXVLAT', type: 'text', label: '计息起息日', grid: 12 / 24 },
  { name: 'JXMODT', type: 'text', label: '计息到期日', grid: 12 / 24 },
  { name: 'ZXLL', type: 'number', dataType: 'number', label: '执行利率', grid: 12 / 24 },
  { name: 'FTPCK', type: 'text', label: 'FTP参考', grid: 12 / 24 },
  { name: 'FTPZ', type: 'number', dataType: 'number', label: 'FTP值', grid: 12 / 24 },
  { name: 'FTPLC', type: 'number', dataType: 'number', label: 'FTP利差', grid: 12 / 24 },
  { name: 'QX1', type: 'number', dataType: 'number', label: '本月期限', grid: 12 / 24 },
  {
    name: 'LR1',
    type: 'number',
    dataType: 'number',
    label: '本月利润',
    grid: 12 / 24,
    rules: [{ required: true, message: '不能为空' }],
  },
  { name: 'JFJS', type: 'text', label: '绩费计算', grid: 12 / 24 },
  {
    name: 'GH1',
    type: 'text',
    label: '工号1',
    grid: 12 / 24,
    rules: [{ required: true, message: '不能为空' }],
  },
  {
    name: 'KHJL1',
    type: 'text',
    label: '客户经理1',
    grid: 12 / 24,
    rules: [{ required: true, message: '不能为空' }],
  },
  {
    name: 'ZB1',
    type: 'number',
    dataType: 'number',
    label: '占比1',
    grid: 12 / 24,
    rules: [{ required: true, message: '不能为空' }],
  },
  { name: 'GH2', type: 'text', label: '工号2', grid: 12 / 24 },
  { name: 'KHJL2', type: 'text', label: '客户经理2', grid: 12 / 24 },
  { name: 'ZB2', type: 'number', dataType: 'number', label: '占比2', grid: 12 / 24 },
  { name: 'GH3', type: 'text', label: '工号3', grid: 12 / 24 },
  { name: 'KHJL3', type: 'text', label: '客户经理3', grid: 12 / 24 },
  { name: 'ZB3', type: 'number', dataType: 'number', label: '占比3', grid: 12 / 24 },
];

const ShCompTydqForm: React.FC = () => {
  return (
    <CommonPage
      daoName={daoName}
      columns={columns}
      controls={controls}
      title="同业定期台账"
      importName={importName}
      importControls={controlsImport}
      importMode="DeleteAfterInsert"
      importParamNames={['DTID']}
      importTemplateName="同业定期台账导入"
      initSorter={{ FieldName: 'DTID', Direction: 'DESC' }}
    />
  );
};

export default ShCompTydqForm;
